package org.xurui.bsj.protocol.command;

import org.jetlinks.core.message.CommonDeviceMessage;
import org.jetlinks.core.message.DeviceMessage;
import org.jetlinks.core.message.codec.EncodedMessage;
import org.jetlinks.core.message.codec.FromDeviceMessageContext;
import org.xurui.bsj.protocol.msg.BsjMessage;
import org.xurui.bsj.protocol.utils.BinaryUtils;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public interface CmdCodec {
    //是否支持命令
    public boolean supportsCmd(String cmd);


    //消息解码
    default public List<DeviceMessage> parsePayload(BsjMessage payload, FromDeviceMessageContext context){return null;};

    //消息编码
    default public EncodedMessage encodeMessage(CommonDeviceMessage message, String iccid){return null;};

    default List<DeviceMessage> genDeviceMessage(DeviceMessage... deviceMessages){
        return Arrays.asList(deviceMessages);
    }
}
